package org.raymond.iworks.study.basic.designpattern.iterator;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author raymond
 * @version V1.0
 * @Description: TODO
 */
public class InfoCollege implements College{
    private List<Department> departmentList;

    public InfoCollege() {
        departmentList = new ArrayList<>();
        addDepartment("信息安全", "信息安全");
        addDepartment("网络安全", "网络安全");
        addDepartment("密码学", "密码学");
    }

    @Override
    public Iterator createIterator() {
        return new InfoCollegeIterator(departmentList);
    }

    @Override
    public String name() {
        return "信息工程学院";
    }

    @Override
    public void addDepartment(String name, String desc) {
        Department department = new Department(name, desc);
        departmentList.add(department);
    }
}
